#include "transport.h"
#include <string.h>
#include "net_api.h"



unsigned char transport_open(char* addr, int port)
{    
	return Net_Api.Connect_Server(( char *)addr,port);   
}

unsigned char transport_sendPacketBuffer(unsigned char* buf, int buflen)
{
	int rc = 1;
    Net_Api.SendData(buf,buflen);
	return rc;
}


int transport_getdata(unsigned char* buf, int count)
{
	unsigned short bytes;
	
	if(fifo_get.Counter>0){
		if(count <= fifo_get.Counter){
			bytes = count;
		}else{
			bytes = fifo_get.Counter;
		}
	}
	FIFO_Get(&fifo_get, buf, bytes);
	return bytes;
}

int transport_close()
{
	Net_Api.DisConnect();
	return 1;
}

	


